home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / ETC / UNIXEXTRA < prev   
Text File  |  1991-05-15  |  2KB  |  48 lines

  1. #!/bin/awk -f
  2. #
  3. # There have been several questions recently about how to handle
  4. # comp.binaries.acorn postings on a un*x box. Here's one way.....
  5. #
  6. # Because of the way !Extract works, and tries to be filing system/path
  7. # independent, it is not possible for the filename to be anything other than
  8. # the one used.
  9. #
  10. # However, below is an AWK script which will combine the parts together and
  11. # uudecode them, then rename the file to either "tar.Z" or just "tar" if it
  12. # wasn't compressed.
  13. #
  14. # The syntax for the script is
  15. #
  16. #decode part1 part2 part3 ...
  17. #
  18. #--Philip Colmer (pcolmer@acorn.co.uk)
  19. #
  20. # This is specific to the format used in comp.binaries.acorn,
  21. # in particular it recognises the !Submit, !Extract structure.
  22. BEGIN                                   {ok=0;decoding=0;file=""}
  23. # Following recognises the first begin line
  24. /begin [0-9][0-9][0-9] /                {ok=1;decoding=1;file=$3}
  25. # And these are for subsequent archives 
  26. /begin part /                           {if (decoding) ok=1; next}
  27. # Following is in case the archive headers are removed
  28. /^M/ && (length == 61 || length == 62)  {if (decoding) ok=1}
  29. # The end of an archive
  30. /^include/                              {ok = 0;next}
  31. # And just in case it is truncated
  32. /^From:/                                {ok = 0;next}
  33. /^Path:/                                {ok = 0;next}
  34. /^Message/                              {ok = 0;next}
  35. # If ok decode the archive
  36.                                         {if (ok) print | "uudecode" }
  37. # The archive end is marked by end at the line start
  38. /^end/                                  {ok = 0;decoding=0;}
  39. # Fix up the file name
  40. END{
  41.      if (filename = "<SubExtWrk$Dir>.Work.File-Z")
  42.           print | "mv '" filename "' tar.Z";
  43.      else if (filename = "<SubExtWrk$Dir>.Work.File")
  44.           print | "mv '" filename "' tar";
  45. }
  46.  
  47.  
  48.